package com.ncst.backend.service.impl;

import com.ncst.backend.domain.MedicalTechnology;
import com.ncst.backend.mapper.MedicalTechnologyMapper;
import com.ncst.backend.service.MedicalTechnologyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 医技项目服务实现类
 */
@Service
public class MedicalTechnologyServiceImpl implements MedicalTechnologyService {

    @Autowired
    private MedicalTechnologyMapper medicalTechnologyMapper;

    @Override
    public MedicalTechnology getById(Integer id) {
        return medicalTechnologyMapper.selectById(id);
    }

    @Override
    public List<MedicalTechnology> getAll() {
        return medicalTechnologyMapper.selectAll();
    }

    @Override
    public List<MedicalTechnology> getByCondition(MedicalTechnology medicalTechnology) {
        return medicalTechnologyMapper.selectByCondition(medicalTechnology);
    }

    @Override
    public List<MedicalTechnology> getByName(String name) {
        return medicalTechnologyMapper.selectByName(name);
    }

    @Override
    public List<MedicalTechnology> getByPage(Integer pageNum, Integer pageSize) {
        return medicalTechnologyMapper.selectByPage((pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public List<MedicalTechnology> getByPage(Integer pageNum, Integer pageSize, MedicalTechnology medicalTechnology) {
        return medicalTechnologyMapper.selectByPageWithCondition((pageNum - 1) * pageSize, pageSize, medicalTechnology);
    }

    @Override
    public Long countAll() {
        return medicalTechnologyMapper.countAll();
    }

    @Override
    public Long countByCondition(MedicalTechnology medicalTechnology) {
        return medicalTechnologyMapper.countByCondition(medicalTechnology);
    }

    @Override
    public boolean save(MedicalTechnology medicalTechnology) {
        return medicalTechnologyMapper.insert(medicalTechnology) > 0;
    }

    @Override
    public boolean saveBatch(List<MedicalTechnology> list) {
        return medicalTechnologyMapper.insertBatch(list) > 0;
    }

    @Override
    public boolean updateById(MedicalTechnology medicalTechnology) {
        return medicalTechnologyMapper.updateById(medicalTechnology) > 0;
    }

    @Override
    public boolean removeById(Integer id) {
        return medicalTechnologyMapper.deleteById(id) > 0;
    }

    @Override
    public boolean removeByIds(List<Integer> ids) {
        return medicalTechnologyMapper.deleteByIds(ids) > 0;
    }

    @Override
    public List<MedicalTechnology> getChuZhi() {
        return medicalTechnologyMapper.getChuZhi();
    }
}
